package one.stand.controller;

import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.jmp.api.user.dto.OrdersInfoResponse;
import com.jmp.api.user.dto.OrdersListResponse;
import com.jmp.api.user.model.ShopCartInfoDto;
import com.jmp.autocofiguration.web.interceptor.SecurityAuthCheck;
import com.jmp.base.dto.*;
import com.jmp.feign.OrderFeign;
import com.jmp.feign.ShopCartFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import one.stand.advice.ResultEnum;
import one.stand.dto.Company2Dto;
import one.stand.dto.ConvertUtils;
import one.stand.dto.UserDto;
import one.stand.enums.OrderStateEnum;
import one.stand.mapper.GoodSpecMapperExt;
import one.stand.mapper.GoodsApiUserMapper;
import one.stand.model.*;
import one.stand.request.CollectionRequest;
import one.stand.request.OrderinfoRequest;
import one.stand.request.OrdersRequest;
import one.stand.request.ShopcartRequest;
import one.stand.response.ShopcartResponse;
import one.stand.service.BusinessCardBaseService;
import one.stand.service.CompanyBaseService;
import one.stand.service.GoodsBaseService;
import one.stand.service.user.UserAdminService;
import one.stand.service.wx.WxPayService;
import one.stand.util.AssertUtil;
import one.stand.util.MoneyUtil;
import one.stand.util.RequestContext;
import one.stand.util.RequestContextHolder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * 订单信息
 *
 * @author Administrator
 */
@RestController
@RequestMapping("userApi/orders")
@Api(description = "订单系列")
public class OrdersController extends BaseController {
    @Autowired
    private OrderFeign orderFeign;
    @Autowired
    private ShopCartFeign shopCartFeign;

    @Autowired
    private GoodsBaseService goodsBaseService;
    @Autowired
    private GoodSpecMapperExt goodSpecMapperExt;
    @Autowired
    private CompanyBaseService companyBaseService;
    @Autowired
    private WxPayService wxPayService;
    @Autowired
    private UserAdminService userAdminService;
    @Autowired
    private BusinessCardBaseService businessCardBaseService;

    @Autowired
    private GoodsApiUserMapper goodsApiUserMapper;

    @ApiOperation(value = "查询我的购物车")
    @PostMapping("/selectShopcart")
    @SecurityAuthCheck
    public ResultModel<List<ShopcartResponse>> selectShopcartgetUserInfo() {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<ShopCartListVo> resultModel = shopCartFeign.list(ShopCartListDto.builder().userId(optUser.getUserId()).build());
        AssertUtil.isTrue(resultModel);

        List<ShopcartResponse> shopcartResponseList = ConvertUtils.list(resultModel.getData().getSupplierList(), supplier -> {

            Company2Dto company2Dto = companyBaseService.get2(supplier.getCompanyId());

            ShopcartResponse shopcartResponse = new ShopcartResponse();
            shopcartResponse.setCompanyId(supplier.getCompanyId());
            shopcartResponse.setCompanyLogo(company2Dto.getCompanyLogo());
            shopcartResponse.setCompanyName(company2Dto.getCompanyName());
            shopcartResponse.setShopcartModelList(ConvertUtils.list(supplier.getGoodsList(), goods -> {
                ShopcartModel shopcartModel = new ShopcartModel();
                shopcartModel.setShopCartId(goods.getShopCartId());
                shopcartModel.setUserId(optUser.getUserId());
                shopcartModel.setCompanyId(supplier.getCompanyId());
                shopcartModel.setSpecId(goods.getSpecId());
                shopcartModel.setNum(goods.getNum());
                shopcartModel.setCardId(goods.getCardId());
                shopcartModel.setForwardId(goods.getForwardId());

                shopcartModel.setPhotoUrl(goods.getPhoto());
                shopcartModel.setGoodsId(goods.getGoodsId());
                shopcartModel.setGoodsName(goods.getGoodsName());
                shopcartModel.setSpecName(goods.getSpecName());
                shopcartModel.setSpecAttribute(goods.getSpecAttribute());
                shopcartModel.setSpecNum(goods.getSpecNum());
                shopcartModel.setPrice(MoneyUtil.getMoneyInt(goods.getPrice()));
                return shopcartModel;
            }));

            return shopcartResponse;
        });
        return ResultModel.success(shopcartResponseList);
    }

    @ApiOperation(value = "保存商品到购物车")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "specId", value = "规格ID", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "num", value = "数量", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "forwardId", value = "转发id", paramType = "Integer"),
            @ApiImplicitParam(name = "cardId", value = "名片ID（用户进入企业商城时选择的名片ID）", required = true, paramType = "Integer"),
    })
    @PostMapping("/addShopcart")
    @SecurityAuthCheck
    public ResultModel addShopcart(@RequestAttribute ShopcartRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();
        ResultModel resultModel = shopCartFeign.add(ShopCartAddDto.builder()
                .userId(optUser.getUserId())
                .specId(request.getSpecId())
                .num(request.getNum())
                .cardId(request.getCardId())
                .forwardId(request.getForwardId())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "删除购物车商品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopCartIds", value = "购物车id(逗号隔开)", required = true, paramType = "String"),
    })
    @PostMapping("/delShopcart")
    @SecurityAuthCheck
    public ResultModel delShopcart(@RequestAttribute ShopcartRequest request) {
        AssertUtil.nonNull(request.getShopCartIds(), ResultEnum.PARAM_CHECK);

        String[] ids = StringUtils.split(request.getShopCartIds(), StrUtil.COMMA);

        ResultModel resultModel = shopCartFeign.remove(ShopCartRemoveDto.builder()
                .shopCartId(ConvertUtils.list(Lists.newArrayList(ids), Integer::valueOf))
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "修改购物车商品数量")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopCartId", value = "购物车id", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "num", value = "数量", required = true, paramType = "Integer"),
    })
    @PostMapping("/updShopcartNum")
    @SecurityAuthCheck
    public ResultModel updShopcartNum(@RequestAttribute ShopcartRequest request) {
        ResultModel resultModel = shopCartFeign.edit(ShopCartEditDto.builder()
                .shopCartId(request.getShopCartId())
                .num(request.getNum())
                .build());
        AssertUtil.isTrue(resultModel);
        return ResultModel.success();
    }

    @PostMapping("/directOrder")
    @ApiOperation(value = "商品直接下单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "specId", value = "规格ID", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "num", value = "数量", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "remark", value = "备注", paramType = "String"),
            @ApiImplicitParam(name = "allPrice", value = "订单金额", required = true, paramType = "Integer"),
            @ApiImplicitParam(name = "forwardId", value = "转发id", paramType = "Integer"),
            @ApiImplicitParam(name = "cardId", value = "名片ID（用户进入企业商城时选择的名片ID）", required = true, paramType = "Integer"),
    })
    @SecurityAuthCheck
    public ResultModel<Integer> directOrder(@RequestAttribute OrderinfoRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        GoodSpec goodSpecModel = goodSpecMapperExt.selectByPrimaryKey(request.getSpecId());
        AssertUtil.nonNull(goodSpecModel, ResultEnum.FAIL, "商品规格失效，请重新筛选！");
        Goods goods = goodsBaseService.getOn(goodSpecModel.getGoodsId());
        AssertUtil.nonNull(goods, ResultEnum.PARAM_CHECK, "商品已下架");

        OrderSaveDto.Goods goods1 = OrderSaveDto.Goods.builder()//商品
                .specId(request.getSpecId())
                .num(request.getNum())
                .shopCartId(null)
                .cardId(request.getCardId())
                .forwardId(request.getForwardId())
                .build();
        OrderSaveDto.Supplier supplier = OrderSaveDto.Supplier.builder()
                .companyId(goods.getCompanyId())
                .totalPrice(null)
                .remark(request.getRemark())
                .goodsList(Lists.newArrayList(goods1))
                .build();

        ResultModel<OrderSaveVo> resultModel = orderFeign.save(OrderSaveDto.builder()
                .checkFlag(false)
                .userId(optUser.getUserId())
                .addressId(null)
                .total(null)
                .totalPrice(null)
                .supplierList(Lists.newArrayList(supplier))
                .build());
        AssertUtil.isTrue(resultModel);

        Integer orderId = resultModel.getData().getOrderIds().get(0);
        return ResultModel.success(orderId);
    }

    @ApiOperation(value = "查询用户订单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderState", value = "订单状态（1待付款，2待发货，3待收货，4已完成，5交易取消，6退款成功）", required = true, paramType = "Integer"),
    })
    @PostMapping("/getOrderList")
    @SecurityAuthCheck
    public ResultModel<List<OrdersListResponse>> getOrderList(@RequestAttribute OrdersRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel<OrderListVo> resultModel = orderFeign.list(OrderListDto.builder()
                .userId(optUser.getUserId())
                .status(request.getOrderState() == 5 ? 6 : request.getOrderState())
                .build());
        AssertUtil.isTrue(resultModel);

        UserDto user = userAdminService.get(optUser.getUserId());
        BusinessCard card = businessCardBaseService.getByUserId(user.getUserId());

        List<OrdersListResponse> responses = ConvertUtils.list(resultModel.getData().getOrderPage().getList(), order -> {

            Company2Dto company2Dto = companyBaseService.get2(order.getCompanyId());
            Integer allNum = order.getGoodsList().stream().mapToInt(OrderListVo.Goods::getSkuNum).sum();

            return OrdersListResponse.builder()
                    .ordersId(order.getOrderId())
                    .orderPrice(MoneyUtil.getMoneyInt(order.getOrderPrice()))
                    .orderState(order.getOrderState())
                    .refundState(order.getRefundState())
                    .refundRemark(order.getRefundRemark())
                    .payPrice(MoneyUtil.getMoneyInt(order.getOrderPrice()))

                    .companyId(order.getCompanyId())
                    .companyName(company2Dto.getCompanyName())

                    .userId(user.getUserId())
                    .logo(user.getUserImg())
                    .name(user.getName())
                    .phone(user.getPhone())
                    .personalWx(Objects.nonNull(card) ? card.getPersonalWx() : null)

                    .ordersModelList(ConvertUtils.list(order.getGoodsList(), goods -> {
                        return OrdersListResponse.Goods.builder()
                                .goodsId(goods.getGoodsId())
                                .goodsName(goods.getGoodsName())
                                .photoUrl(goods.getGoodsPhoto())
                                .specAttribute(StringUtils.EMPTY)
                                .specName(goods.getSkuName())
                                .num(goods.getSkuNum())
                                .price(MoneyUtil.getMoneyInt(goods.getPrice()))
                                .allPrice(MoneyUtil.getMoneyInt(goods.getPrice().multiply(BigDecimal.valueOf(goods.getSkuNum()))))
                                .cardId(goods.getCardId())
                                .build();
                    }))
                    .allNum(allNum)

                    .build();
        });
        return ResultModel.success(responses);
    }

    @ApiOperation(value = "查询用户订单数量")
    @PostMapping("/getOrderListCount")
    @SecurityAuthCheck
    public ResultModel<List<OrderCountVo.StateVo>> getOrderListCount() {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();
        ResultModel<OrderCountVo> resultModel = orderFeign.count(OrderCountDto.builder().userId(optUser.getUserId()).build());
        AssertUtil.isTrue(resultModel);
        return ResultModel.success(resultModel.getData().getResult());
    }

    @ApiOperation(value = "去支付")
    @PostMapping("/goPay")
    @SecurityAuthCheck
    public ResultModel<Map<String, String>> goPay(@RequestAttribute OrdersRequest request) {
        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();
        ResultModel<OrderPayWxJsapiVo> resultModel = orderFeign.payWxJsapi(OrderPayWxJsapiDto.builder()
                .orderId(request.getOrdersId())
                .addressId(request.getAddressId())
                .remark(request.getRemark())
                .optUserId(optUser.getUserId())
                .build());
        AssertUtil.isTrue(resultModel);
        return ResultModel.success(resultModel.getData().getPayInfo());
    }

    @RequestMapping(value = "/paymentOrders")
    public String paymentOrders(HttpServletRequest request) {
        try {
            BufferedReader reader = request.getReader();
            String line = "";
            StringBuffer inputString = new StringBuffer();
            while ((line = reader.readLine()) != null) {
                inputString.append(line);
            }
            request.getReader().close();

            ResultModel resultModel = orderFeign.payWxJsapiBack(OrderPayWxAppBackDto.builder()
                    .notifyData(inputString.toString())
                    .build());
            AssertUtil.isTrue(resultModel);

            return wxPayService.success();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return wxPayService.fail();
    }

    @ApiOperation(value = "用户提交退款申请")
    @PostMapping("/refundOrder")
    @SecurityAuthCheck
    public ResultModel refundOrder(@RequestAttribute OrdersRequest request) {
        ResultModel resultModel = orderFeign.refundApply(OrderRefundApplyDto.builder()
                .orderId(request.getOrdersId())
                .refundRemark(request.getRefundRemark())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "用户撤销退款申请")
    @PostMapping("/backRefundState")
    @SecurityAuthCheck
    public ResultModel backRefundState(@RequestAttribute OrdersRequest request) {
        ResultModel resultModel = orderFeign.refundCancel(OrderRefundCancelDto.builder().orderId(request.getOrdersId()).build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "购物车下单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopCartIds", value = "购物车ID", required = true, paramType = "String"),
            @ApiImplicitParam(name = "money", value = "购物车总金额金额", required = true, paramType = "Integer"),
    })
    @PostMapping("/shopcartOrder")
    @SecurityAuthCheck
    public ResultModel<String> shopcartOrder(@RequestAttribute ShopcartRequest request) {

        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        List<ShopCartInfoDto> shopcartModels = goodsApiUserMapper.selectShopCartInfo(optUser.getUserId(), request.getShopCartIds().split(","));
        Integer companyId = null;
        List<OrderSaveDto.Goods> goodsList = Lists.newArrayList();
        for (ShopCartInfoDto shopcartModel : shopcartModels) {
            if (Objects.nonNull(companyId)) {
                AssertUtil.isTrue(companyId.equals(shopcartModel.getCompanyId()), ResultEnum.FAIL, "只能选择同一公司商品下单~!");
            } else {
                companyId = shopcartModel.getCompanyId();
            }

            goodsList.add(OrderSaveDto.Goods.builder()//商品
                    .specId(shopcartModel.getSpecId())
                    .num(shopcartModel.getNum())
                    .shopCartId(shopcartModel.getShopCartId())
                    .cardId(shopcartModel.getCardId())
                    .forwardId(shopcartModel.getForwardId())
                    .build());
        }

        OrderSaveDto.Supplier supplier = OrderSaveDto.Supplier.builder()
                .companyId(companyId)
                .totalPrice(MoneyUtil.getMoney(request.getMoney()))
                .remark(null)
                .goodsList(goodsList)
                .build();

        ResultModel<OrderSaveVo> resultModel = orderFeign.save(OrderSaveDto.builder()
                .checkFlag(false)
                .userId(optUser.getUserId())
                .addressId(null)
                .total(null)
                .totalPrice(null)
                .supplierList(Lists.newArrayList(supplier))
                .build());
        AssertUtil.isTrue(resultModel);

        String orderIds = StrUtil.join(StrUtil.COMMA, resultModel.getData().getOrderIds());

        return ResultModel.success(orderIds);
    }

    @PostMapping("/shopAddCollection")
    @ApiOperation(value = "购物车添加收藏")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "itemIds", value = "商品id（逗号隔开）", required = true, paramType = "String"),
            @ApiImplicitParam(name = "itemType", value = "收藏对象类型（1产品，2文章，3企业）", required = true, paramType = "Integer"),
    })
    @SecurityAuthCheck
    public ResultModel shopAddCollection(@RequestAttribute CollectionRequest request) {
        return userFegin.shopAddCollection(request);
    }

    @ApiOperation(value = "下单时订单详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordersIds", value = "订单id(逗号隔开)", required = true, paramType = "String"),
    })
    @PostMapping("/getOrderInfo")
    @SecurityAuthCheck
    public ResultModel<List<OrdersInfoResponse>> getOrderInfo(@RequestAttribute OrdersRequest request) {
        AssertUtil.nonNull(request.getOrdersIds(), ResultEnum.NO_PARAM);
        int[] orderIds = StrUtil.splitToInt(request.getOrdersIds(), CharUtil.COMMA);
        AssertUtil.nonNull(orderIds, ResultEnum.NO_PARAM);

        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        List<OrdersInfoResponse> list = Lists.newArrayList();
        for (int orderId : orderIds) {
            ResultModel<OrderDetailVo> resultModel = orderFeign.detail(OrderDetailDto.builder().orderId(orderId).build());
            AssertUtil.isTrue(resultModel);
            OrderDetailVo vo = resultModel.getData();

            Company2Dto company2Dto = companyBaseService.get2(vo.getCompanyId());
            Integer allNum = vo.getGoodsList().stream().mapToInt(OrderDetailVo.Goods::getSkuNum).sum();
            UserDto user = userAdminService.get(optUser.getUserId());
            BusinessCard card = businessCardBaseService.getByUserId(user.getUserId());

            list.add(OrdersInfoResponse.builder()
                    .ordersId(vo.getOrderId())
                    .ordersNo(vo.getOrderNo())
                    .tradeNo(vo.getTradeNo())
                    .orderPrice(MoneyUtil.getMoneyInt(vo.getOrderPrice()))
                    .orderState(vo.getOrderState())
                    .createTime(new Date(vo.getOrderCreateTime()))
                    .payType(vo.getPayType())
                    .payPrice(MoneyUtil.getMoneyInt(vo.getPayPrice()))
                    .payTime(Objects.nonNull(vo.getOrderPayTime()) ? new Date(vo.getOrderPayTime()) : null)
                    .deliveryType(vo.getDeliveryType())
                    .remark(vo.getOrderRemark())

                    .refundState(vo.getRefundState())
                    .refundRemark(vo.getRefundRemark())

                    .addressId(vo.getAddressId())
                    .detailedAddress(vo.getAddressDetail())
                    .receiveName(vo.getAddressName())
                    .receivePhone(vo.getAddressPhone())

                    .companyId(company2Dto.getCompanyId())
                    .companyName(company2Dto.getCompanyName())

                    .userId(user.getUserId())
                    .logo(user.getUserImg())
                    .name(user.getName())
                    .phone(user.getPhone())
                    .personalWx(Objects.nonNull(card) ? card.getPersonalWx() : null)

                    .ordersModelList(ConvertUtils.list(vo.getGoodsList(), goods -> {
                        return OrdersInfoResponse.Goods.builder()
                                .goodsId(goods.getGoodsId())
                                .goodsName(goods.getGoodsName())
                                .photoUrl(goods.getGoodsPhoto())
                                .specAttribute(StringUtils.EMPTY)
                                .specName(goods.getSkuName())
                                .num(goods.getSkuNum())
                                .price(MoneyUtil.getMoneyInt(goods.getPrice()))
                                .allPrice(MoneyUtil.getMoneyInt(goods.getPrice().multiply(BigDecimal.valueOf(goods.getSkuNum()))))
                                .cardId(goods.getCardId())
                                .build();
                    }))
                    .allNum(allNum)
                    .build());
        }

        return ResultModel.success(list);
    }

    @PostMapping("/getPayOrderInfo")
    @ApiOperation(value = "待支付时订单详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordersIds", value = "订单id", required = true, paramType = "String"),
    })
    @SecurityAuthCheck
    public ResultModel<List<OrdersInfoResponse>> getPayOrderInfo(@RequestAttribute OrdersRequest request) {
        return getOrderInfo(request);
    }

    @ApiOperation(value = "修改订单状态")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordersId", value = "订单id", required = true, paramType = "String"),
            @ApiImplicitParam(name = "orderState", value = "订单状态（1待付款，2待发货，3待收货，4已完成，5交易取消，6退款成功）", required = true, paramType = "Integer"),
    })
    @PostMapping("/updateOrderState")
    @SecurityAuthCheck
    public ResultModel updateOrderState(@RequestAttribute OrdersRequest request) {
        if (request.getOrderState().equals(OrderStateEnum.CANCEL.getCode())) {
            ResultModel resultModel = orderFeign.cancel(OrderCancelDto.builder()
                    .orderId(request.getOrdersId())
                    .build());
            AssertUtil.isTrue(resultModel);
        } else if (request.getOrderState().equals(OrderStateEnum.COMPLETE.getCode())) {
            ResultModel resultModel = orderFeign.complete(OrderCancelDto.builder()
                    .orderId(request.getOrdersId())
                    .build());
            AssertUtil.isTrue(resultModel);
        } else {
            AssertUtil.fail(ResultEnum.FAIL);
        }

        return ResultModel.success();
    }

    @ApiOperation(value = "提醒发货")
    @PostMapping("/doReminder")
    @SecurityAuthCheck
    public ResultModel doReminder(@RequestAttribute OrdersRequest request) {

        ResultModel resultModel = orderFeign.remindSend(OrderRemindSendDto.builder()
                .orderId(request.getOrdersId())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

    @ApiOperation(value = "再来一单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ordersId", value = "订单id", required = true, paramType = "Integer"),
    })
    @PostMapping("/anotherOrder")
    @SecurityAuthCheck
    public ResultModel anotherOrder(@RequestAttribute OrdersRequest request) {

        final RequestContext.User optUser = RequestContextHolder.getRequestContext().getUser();

        ResultModel resultModel = orderFeign.saveAgain(OrderSaveAgainDto.builder()
                .userId(optUser.getUserId())
                .orderId(request.getOrdersId())
                .build());
        AssertUtil.isTrue(resultModel);

        return ResultModel.success();
    }

}
